[XEN] Make tlbflush_time a PER_CPU variable.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Aug 2006 10:45:37 +0000 (11:45 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Aug 2006 10:45:37 +0000 (11:45 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/powerpc/setup.c
xen/arch/x86/flushtlb.c
xen/arch/x86/x86_32/domain_page.c
xen/include/asm-powerpc/flushtlb.h
xen/include/asm-x86/current.h
xen/include/asm-x86/flushtlb.h
xen/include/xen/percpu.h

index dbb4dfe0b8ca5db6f793bb100126ef3b3f058f80..8c064d6cb0fadab3fff3c95945bd0f75d1abd19a 100644 (file)
@@ -55,7 +55,7 @@ int opt_earlygdb = 0;
 boolean_param("earlygdb", opt_earlygdb);
 
 u32 tlbflush_clock = 1U;
-u32 tlbflush_time[NR_CPUS];
+DEFINE_PER_CPU(u32, tlbflush_time);
 
 unsigned int watchdog_on;
 unsigned long wait_init_idle;
index 5e132a7a145501b3d24f1903fb784df89c5cc5cd..e3415dd3dddb4ae7c8a31cecd968b269d02c340a 100644 (file)
@@ -20,7 +20,7 @@
 #endif
 
 u32 tlbflush_clock = 1U;
-u32 tlbflush_time[NR_CPUS];
+DEFINE_PER_CPU(u32, tlbflush_time);
 
 void write_cr3(unsigned long cr3)
 {
@@ -71,7 +71,7 @@ void write_cr3(unsigned long cr3)
      *         case, so really we are being ultra paranoid.
      */
 
-    tlbflush_time[smp_processor_id()] = t2;
+    this_cpu(tlbflush_time) = t2;
 
     local_irq_restore(flags);
 }
index 4a7362d7e23c11de6e1078b2a918d6bb7681b111..db3237242c4bf8253e2c63f1a5af5eba39810902 100644 (file)
@@ -73,8 +73,7 @@ void *map_domain_page(unsigned long pfn)
     if ( unlikely(cache->epoch != cache->shadow_epoch[vcpu]) )
     {
         cache->shadow_epoch[vcpu] = cache->epoch;
-        if ( NEED_FLUSH(tlbflush_time[smp_processor_id()],
-                        cache->tlbflush_timestamp) )
+        if ( NEED_FLUSH(this_cpu(tlbflush_time), cache->tlbflush_timestamp) )
         {
             perfc_incrc(domain_page_tlb_flush);
             local_flush_tlb();
index 67e454a0fd05e86f2c2970bcff64f825a962c8c2..9b77c46f1fd2e0becfc97cfe5645428c0f5c659e 100644 (file)
@@ -22,6 +22,7 @@
 #define _ASM_FLUSHTLB_H_
 
 #include <xen/config.h>
+#include <xen/percpu.h>
 #include <xen/types.h>
 #include <asm/misc.h>
 
@@ -30,7 +31,7 @@ extern u32 tlbflush_clock;
 #define tlbflush_current_time() tlbflush_clock
 
 /* Time at which each CPU's TLB was last flushed. */
-extern u32 tlbflush_time[NR_CPUS];
+DECLARE_PER_CPU(u32, tlbflush_time);
 
 static inline int NEED_FLUSH(u32 cpu_stamp, u32 lastuse_stamp)
 {
@@ -44,12 +45,12 @@ static inline int NEED_FLUSH(u32 cpu_stamp, u32 lastuse_stamp)
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
  */
-#define tlbflush_filter(mask, page_timestamp)                   \
-do {                                                            \
-    unsigned int cpu;                                           \
-    for_each_cpu_mask ( cpu, mask )                             \
-        if ( !NEED_FLUSH(tlbflush_time[cpu], page_timestamp) )  \
-            cpu_clear(cpu, mask);                               \
+#define tlbflush_filter(mask, page_timestamp)                           \
+do {                                                                    \
+    unsigned int cpu;                                                   \
+    for_each_cpu_mask ( cpu, mask )                                     \
+        if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
+            cpu_clear(cpu, mask);                                       \
 } while ( 0 )
 
 
index 9b0b6e52453de434e63b00faa5e15ce9dc0f356d..0a423fba67f1186765d59f452ba510989f04397b 100644 (file)
@@ -8,6 +8,7 @@
 #define __X86_CURRENT_H__
 
 #include <xen/config.h>
+#include <xen/percpu.h>
 #include <public/xen.h>
 #include <asm/page.h>
 
@@ -53,7 +54,6 @@ static inline struct cpu_info *get_cpu_info(void)
 
 #define schedule_tail(vcpu) (((vcpu)->arch.schedule_tail)(vcpu))
 
-#include <xen/percpu.h>
 /*
  * Which VCPU's state is currently running on each CPU?
  * This is not necesasrily the same as 'current' as a CPU may be
index 4cc3a41c67e65b901a35e7f25b7c909663b07014..82cb7a7cfe5dcb556dccf5ed16e873769ee04666 100644 (file)
 #define __FLUSHTLB_H__
 
 #include <xen/config.h>
+#include <xen/percpu.h>
 #include <xen/smp.h>
+#include <xen/types.h>
 
 /* The current time as shown by the virtual TLB clock. */
 extern u32 tlbflush_clock;
 
 /* Time at which each CPU's TLB was last flushed. */
-extern u32 tlbflush_time[NR_CPUS];
+DECLARE_PER_CPU(u32, tlbflush_time);
 
 #define tlbflush_current_time() tlbflush_clock
 
@@ -47,12 +49,12 @@ static inline int NEED_FLUSH(u32 cpu_stamp, u32 lastuse_stamp)
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
  */
-#define tlbflush_filter(mask, page_timestamp)                   \
-do {                                                            \
-    unsigned int cpu;                                           \
-    for_each_cpu_mask ( cpu, mask )                             \
-        if ( !NEED_FLUSH(tlbflush_time[cpu], page_timestamp) )  \
-            cpu_clear(cpu, mask);                               \
+#define tlbflush_filter(mask, page_timestamp)                           \
+do {                                                                    \
+    unsigned int cpu;                                                   \
+    for_each_cpu_mask ( cpu, mask )                                     \
+        if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
+            cpu_clear(cpu, mask);                                       \
 } while ( 0 )
 
 extern void new_tlbflush_clock_period(void);
index 88fba30e8acea09f0408652377afa91ce30ba48b..34635892a538bebe56e469cbbc3db6358255f15c 100644 (file)
@@ -2,7 +2,6 @@
 #define __XEN_PERCPU_H__
 
 #include <xen/config.h>
-#include <xen/smp.h>
 #include <asm/percpu.h>
 
 /* Preferred on Xen. Also see arch-defined per_cpu(). */